home *** CD-ROM | disk | FTP | other *** search
- /*============================================================
-
- Hide data snow sample program
-
- ============================================================*/
-
- #include "N_Library.h"
-
- void Main_Process(void);
- void Key_Process(void);
-
- short Data_Rsrc = 0;
- long routine_step = 0;
- long wait;
- short S1_X[1024];
- short S1_Y[1024];
- unsigned short S1_D[1024];
- short S1_MX[1024];
- short S1_MY[1024];
- short r = 0,rs=0;
- short speed = -3;
- Boolean q = false;
- Boolean kb=false;
- EventRecord theEvent;
- short Snd_List0[] = {1000,1001,0};
-
- void main(void)
- {
- WindowPtr window;
- short i;
-
- ToolboxInit();
- ColorCheck();
- HideMenuBar();
- window = GetNewWindow (128,nil,(WindowPtr)-1L );
- N_Window_Set(window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),640,480);
- N_Sp_Make(640,480);
- N_Cel_Make2(640,480);
-
- N_Sp_Load("\pSnow Sprites");
- N_Pict_Load("\pSnow Graphics");
- N_Pict_Draw(131,0,0,(GrafPtr)SP_off,true);
- N_Sound_Load(&Snd_List0[0]);
-
- // Button Set-up
- N_Button_Set(0,0,1,10,404,512,0x80000000+100,0x80000000+101,1000,1001); //Q Button
- N_Button_Set(0,1,1,40,404,512,0x80000000+102,0x80000000+103,1000,1001); //C Button
- N_Button_Set(0,2,1,130,364,40,0x80000000+104,0x80000000+105,1000,1001); //up Button
- N_Button_Set(0,3,1,130,442,40,0x80000000+104,0x80000000+105,1000,1001); //down Button
- N_Button_Set(0,4,1,93,404,40,0x80000000+104,0x80000000+105,1000,1001); //left Button
- N_Button_Set(0,5,1,167,404,40,0x80000000+104,0x80000000+105,1000,1001); //right Button
-
-
- routine_step = 0;
- for (i = 0;i!=1024;i++)
- {
- N_Cel_Kill(i);
- S1_X[i] = GetRandom(0,640*32)-640*16;
- S1_Y[i] = GetRandom(0,480*32)-480*16;
- S1_D[i] = GetRandom(1,255);
- S1_MX[i] = GetRandom(0,30)-15;
- S1_MY[i] = GetRandom(0,30)-15;
- }
-
- N_Pict_Effect (131,0,0,3,0,0);
- for (i=0;i!=32;i++)
- {
- Delay(1,&wait);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- N_Pict_Effect (131,0,0,3,1,0);
- }
- N_Button_Put(0);
-
- do
- {
- Main_Process();
- }
- while (q==false);
- N_Sound_Close();
- FlushEvents( everyEvent, 0 );
- ShowMenuBar();
- ColorRevert();
-
- }
-
- void Main_Process(void)
- {
- short i,x,y,ii,p = 0,dist,bt;
- long wrk;
- long xx,yy;
- unsigned long dum;
- char key;
- Boolean emp;
- Point mp;
-
- N_Cel_Put(1800,0x80000000+110,4,356); //PANEL
-
- Key_Process();
- routine_step++;
-
- if (routine_step<64)
- {
- N_Cel_Put(1799,0x80000000+256,212,(short)(routine_step*4-92));
- }
- if (routine_step>=64 && routine_step<192)
- {
- N_Cel_Put(1799,0x80000000+256,212,164);
- }
- if (routine_step>=192 && routine_step <300)
- {
- N_Cel_Put(1799,0x80000000+256,212,(short)164+((routine_step-192)*5));
- }
-
- if (routine_step < 700) ii = routine_step;
- else ii = 700;
-
- for (i = 0;i!=ii;i++)
- {
- S1_X[i] += S1_MX[i]+GetRandom(0,10)-5;
- if (S1_X[i]<-640*16)S1_X[i]=640*16;
- if (S1_X[i]>640*16)S1_X[i]=-640*16;
- S1_Y[i] += S1_MY[i]+GetRandom(0,10)-5;
- if (S1_Y[i]<-640*16)S1_Y[i]=640*16;
- if (S1_Y[i]>640*16)S1_Y[i]=-640*16;
-
- x = S1_X[i];
- y = S1_Y[i];
-
- wrk = S1_D[i];
- wrk = wrk / 16;
- wrk = 16-wrk;
-
- if (wrk>14) wrk = 15;
-
- N_Cel_3D_Put(i,0x80000000+30+wrk,x,y,320,240,r,S1_D[i]);
- dist = S1_D[i] + speed;
- if (dist < 0)
- {
- dist = 512+dist;
- N_Cel_Get(i,&emp,&dum,&x,&y);
- N_Sp_Put(0x80000000+46,x-4,y-4);
- S1_X[i] = GetRandom(0,640*32)-640*16;
- S1_Y[i] = GetRandom(0,480*32)-480*16;
- }
-
- if (dist > 255)
- {
- dist = dist -256;
- S1_X[i] = GetRandom(0,640*32)-640*16;
- S1_Y[i] = GetRandom(0,480*32)-480*16;
- }
- S1_D[i] = dist;
- }
- r=r+rs;
- N_Cel_Loop2(0,0);
-
- bt=N_Button_Check(0);
-
- if (bt==0) q=true;
- if (bt==1) N_Pict_Draw(131,0,0,(GrafPtr)SP_off,true);
- if (bt==2) speed--;
- if (bt==3) speed++;
- if (bt==4) rs--;
- if (bt==5) rs++;
- }
-
- void Key_Process(void)
- {
- char ky;
-
- ky = N_Key_Get();
- if (kb == false)
- {
- if ((ky & 0x01) !=0)
- {
- speed++;
- N_Button_Push(0,3);
- kb = true;
- }
- if ((ky & 0x02) !=0)
- {
- rs--;
- N_Button_Push(0,4);
- kb = true;
- }
- if ((ky & 0x04) !=0)
- {
- rs++;
- N_Button_Push(0,5);
- kb = true;
- }
- if ((ky & 0x08) !=0)
- {
- speed--;
- N_Button_Push(0,2);
- kb = true;
- }
-
- if ((ky & 0x40) !=0)
- {
- N_Pict_Draw(131,0,0,(GrafPtr)SP_off,true);
- N_Button_Push(0,1);
- kb = true;
- }
- }
-
- if ((ky & 0x80) !=0)
- {
- N_Button_Push(0,0);
- q = true;
- }
- if (ky==0) kb = 0;
- }
-
-
-